package com.bamboo.framework.common.format;

import com.bamboo.framework.common.enums.Status;
import lombok.Data;
import org.springframework.http.HttpStatus;

import java.io.Serializable;

/**
 * @author GuoQing
 */
@Data
public class ReturnMsg implements Serializable {

    private long status;
    private String msg;
    private Object result;

    public ReturnMsg(int status, String msg, Object result) {
        this.status = status;
        this.msg = msg;
        this.result = result;
    }
    public ReturnMsg( Status status, Object result){
        this.status = status.getCode();
        this.msg = status.getMsg();
        this.result = result;
    }
    public ReturnMsg(HttpStatus status, Object result){
        this.status = status.value();
        this.msg = status.getReasonPhrase();
        this.result = result;
    }
    public ReturnMsg( Status status){
        this.status = status.getCode();
        this.msg = status.getMsg();
    }
}
